<template>
  <div>

    <Head />
    <el-tabs v-model="activeName">
      <el-tab-pane label="创建的歌单" name="first">
        <div v-if="activeName === 'first'">
          <Create :create='true' />
        </div>
      </el-tab-pane>
      <el-tab-pane label="收藏的歌单" name="second">
        <div v-if="activeName === 'second'">
          <Create :create='false' />
        </div>
      </el-tab-pane>
      <el-tab-pane label="动态" name="three">
        <div v-if="activeName === 'three'">
          <Event/>
        </div>
      </el-tab-pane>
    </el-tabs>
    <div class="loading" v-if="show === true">
      <i class="el-icon-loading"></i>
    </div>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex';
export default {
  components: {
    Head: () => import('../components/userPage/Head.vue'),
    Create: () => import('../components/userPage/createList.vue'),
    Event:()=>import('../components/userPage/eventPage.vue')
  },
  created() {
    this.saveOpenItem({ openItem: false });
    document.querySelector('.header').style.background = '#ec4141';
  },
  data() {
    return {
      activeName: 'first',
      show: false,
    };
  },
  beforeRouteLeave(to, from, next) {
    this.show = true
    next()
  },
  methods: {
    ...mapActions(['saveOpenItem']),

  },
}
</script>

<style scoped>
</style>
